#ifndef _CTHEME_H_
#define _CTHEME_H_

#include <buola/gui/cmenu.h>

namespace buola { namespace gui {

class CTheme : public UUncopiable
{
public:
    enum EDecoFlags
    {
        DECO_NONE=0,
        DECO_MIN=(1<<0),
        DECO_MAX=(1<<1),
        DECO_CLOSE=(1<<2),
        DECO_DOCK=(1<<3),
        DECO_MENU=(1<<4),
        DECO_ACTIVE=(1<<5),
        DECO_MOUSEIN=(1<<6)
    };
    DECLARE_FRIEND_ENUM_BITOPS(EDecoFlags)

    enum EArrow
    {
        ARROW_LEFT,
        ARROW_RIGHT,
        ARROW_DOWN,
        ARROW_UP
    };

    enum EDrawStyle
    {
        DRAW_NONE=0,
        DRAW_HOVER=(1<<0),
        DRAW_LEFT=(1<<1),
        DRAW_RIGHT=(1<<2),
        DRAW_PRESSED=(1<<3),
        DRAW_UP=(1<<4),
        DRAW_DOWN=(1<<5),
        DRAW_SELECTED=(1<<6),
        DRAW_LEFTARROW=(1<<7),
        DRAW_RIGHTARROW=(1<<8)
    };
    DECLARE_FRIEND_ENUM_BITOPS(EDrawStyle)
    
public:
    CTheme();
    virtual ~CTheme();

public:
    //GC type
    virtual img::EGCCaps GetGCCaps()     {   return img::EGCCaps::NONE;   }

    //controls
    virtual void PrepareButton(CButton*)    {}
    virtual void DrawButton(img::CGC*,CButton*,EDrawStyle)=0;
    virtual void PrepareCheckBox(CCheckBox*)    {}
    virtual void DrawCheckBox(img::CGC*,CCheckBox*,EDrawStyle)=0;
    virtual void PrepareComboBox(CComboBox*)    {}
    virtual void DrawComboBox(img::CGC*,CComboBox*,EDrawStyle)=0;
    virtual void PrepareEditBox(CEditBox*)  {}
    virtual void DrawEditBox(img::CGC*,CEditBox*,EDrawStyle)=0;
    virtual void PrepareLabelBox(CLabelBox*)    {}
    virtual void DrawLabelBox(img::CGC*,CLabelBox*,EDrawStyle)=0;
    virtual void PrepareListBox(CListBox*)  {}
    virtual void DrawListBox(img::CGC*,CListBox*,EDrawStyle)=0;
    virtual void PrepareMenuBar(CMenuBar*)  {}
    virtual void DrawMenuBar(img::CGC*,CMenuBar*,EDrawStyle)=0;
    virtual void PrepareNumBox(CNumBox*)    {}
    virtual void DrawNumBox(img::CGC*,CNumBox*,EDrawStyle)=0;
    virtual void PrepareOptionBox(COptionBox*)  {}
    virtual void DrawOptionBox(img::CGC*,COptionBox*,EDrawStyle)=0;
    virtual void PrepareProgressBar(CProgressBar*)  {}
    virtual void DrawProgressBar(img::CGC*,CProgressBar*,EDrawStyle)=0;
    virtual void PrepareRulerBox(CRulerBox*)    {}
    virtual void DrawRulerBox(img::CGC*,CRulerBox*,EDrawStyle)  {}
    virtual void PrepareScrollBar(CScrollBar*)  {}
    virtual void DrawScrollBar(img::CGC*,CScrollBar*,EDrawStyle)=0;
    virtual void PrepareSliderBox(CSliderBox*)  {}
    virtual void DrawSliderBox(img::CGC*,CSliderBox*,EDrawStyle)=0;
    virtual void PrepareStatusBar(CStatusBar*)  {}
    virtual void DrawStatusBar(img::CGC*,CStatusBar*,EDrawStyle)=0;
    virtual void PrepareTabBox(CTabBox*)    {}
    virtual void DrawTabBox(img::CGC*,const CRect_d&,CTabBox*,EDrawStyle)=0;
    virtual void PrepareToolBar(CToolBar*)  {}
    virtual void DrawToolBar(img::CGC*,CToolBar*,EDrawStyle)=0;
    virtual void PrepareTreeBox(CTreeBox*)  {}
    virtual void DrawTreeBox(img::CGC*,CTreeBox*,EDrawStyle)=0;
    
    //primitives
    virtual void DrawScrollBarCursor(img::CGC *pGC,const CRect_d &pRect,bool pVertical,bool pActive)=0;
    virtual void DrawCheckBoxBox(img::CGC *pGC,const CRect_d &pRect,bool)=0;
    virtual void DrawCursor(img::CGC *pGC,const CRect_d &pRect)=0;
    virtual void DrawHandle(img::CGC *pGC,const CRect_d &pRect,bool=false)=0;
    virtual void PrepareHandleBar(CWindow *pW)=0;
    virtual void DrawHandleBar(img::CGC *pGC,const CRect_d &pRect,
                const std::wstring &pText,EDecoFlags pElements,EDecoFlags pActive)=0;
    virtual void DrawRulerField(img::CGC*,const CRect_d&,const std::wstring&,bool,bool)=0;
    virtual void DrawRulerFieldHL(img::CGC*,const CRect_d&,const std::wstring&,const img::CColor &pColor,bool)=0;
    virtual void DrawLabel(img::CGC*,const CPoint_d&,const std::wstring&)=0;
    virtual void DrawThinBar(img::CGC*,const CRect_d&)=0;
    virtual void DrawShadow(img::CGC*,const CRect_d&)=0;
    virtual void DrawSplitItem(img::CGC*,const CRect_d&,int)=0;
    virtual void DrawSeparationLine(img::CGC*,const CPoint_d&,const CPoint_d&)=0;
    virtual void DrawTabBoxItem(img::CGC*,const CRect_d&,CTabBox*,CTabBoxItem*,EDrawStyle)=0;
    virtual void DrawToolBarItem(img::CGC*,const CRect_d&,CToolBar*,PMenuItem,EDrawStyle)=0;
    virtual void DrawMenuBarItem(img::CGC*,const CRect_d&,CMenuBar*,PMenuItem,EDrawStyle)=0;
    virtual void DrawArrow(img::CGC *pGC,const CPoint_d &pC,EArrow pArrow)=0;
    virtual void PrepareDecoration(CWindow*) {}
    virtual void DrawDecoration(img::CGC*,const CRect_d&,const std::wstring&,EDecoFlags) {}
    
    //size hints
    virtual CSize_d GetLabelSize(const std::wstring &pLabel)=0;
    virtual CSize_d GetScrollBarButtonSize()=0; //for vertical one
    virtual int GetSliderSize()=0;
    virtual CSize_d GetMicroButtonSize()=0;
    virtual double GetResizeBarWidth(EDrawStyle)=0;
    virtual double GetAttachHandleWidth(EAttachFlags)=0;

    //helpers
    virtual void SetBackground(CWindow *pWindow,
                                    int pType=BACKGROUND_DEFAULT)=0;

    static void LoadTheme(const std::wstring&);

protected:
};

/*namespace gui*/ } /*namespace buola*/ }

#endif
